package dryven.view.engine.parser.parts;

import java.io.IOException;
import java.io.Writer;

import dryven.codegen.asm.MethodBuilder;
import dryven.view.ViewDataDictionary;
import dryven.view.engine.parser.ViewComponentLocator;
import dryven.view.engine.parser.ViewDataDeclarationCollection;

public class ViewDataDeclarationPart implements CompiledViewPart {

	private String _name;
	private String _type;
	
	public ViewDataDeclarationPart(String name, String type) {
		super();
		_name = name;
		_type = type;
	}

	@Override
	public void evaluate(ViewDataDictionary viewData, Writer out, ViewDataDeclarationCollection declarations)
			throws IOException {
	}

	@Override
	public void writeInstructions(MethodBuilder builder) {
		// TODO Auto-generated method stub

	}

	@Override
	public void compile(ViewDataDeclarationCollection declarations, ViewComponentLocator locator) {
		System.out.println(String.format("Declaring %s as %s", _name, _type));

		declarations.addViewDataDeclaration(_name, _type);
	}
}
